<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/pages/login/common.jsp" %>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description"/>
<meta content="B2B电商平台" name="keyword"/>

<title>B2B电商平台.修改密码</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/register_icss.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/include/css/mmt_trading.css" />
<script type="text/javascript" src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.common.js"></script>
<style type="text/css">
body{margin:0;padding-left:5px;}
</style>
<script type="text/javascript">
	$(document).ready(function() {
		_findPinNum();
	});
//换一张
function _refresh(){
	var obj=$("#pinpic");
 	obj.attr("src","<%=path %>/verifyCode/refresh.do?widthP=74&heightP=36&t="+Math.random());
}
//下一步
function _next(){
	var flag=_checkVal();
	if(flag){
		window.location.href = '<%=path %>/passwordEdit/toStepTwo.do?uuidBefore='+$("#uuidBefore").val()+"&pwdBefore="+$("#pwdBefore").val()+"&accountBefore="+$("#accountBefore").val();
	}
}

function _checkVal(){
	var result = false;

	//验证码输入是否正确
	_findPinNum();
	var pinNum=$("#pinNum").val();
	var pin=$("#pin").val();
	if(pin.toLowerCase() != pinNum.toLowerCase() ){
		$("#error_pin_tip_tr").show();
		result = false;
	}else{
		$("#error_pin_tip_tr").hide();
		result = true;
	}
	if(!result){
		_refresh();
		return false;
	}
	//密码输入是否正确
	var loginPwd=$("#loginPwd").val();
	var pwdBefore=$("#pwdBefore").val();
	
	$.ajax({
         cache: true,
         type: "POST",
         url: '<%=path%>/passwordEdit/checkLoginPwd.do',
         data:{loginPwd:loginPwd,pwdBefore:pwdBefore},
         async: false,
         dataType:"json",
         error: function(request) {
           alert('操作失败，请稍候重试!');  
         },
        success:function(data){
			if(data.success){
				$("#error_pwd_tip").hide();
				result = true;
			} else {
				$("#error_pwd_tip").show();
				result = false;
			}
		}
    });
	
	return result;
}



//查询验证码数值
function _findPinNum(){
	 $.ajax({
             cache: true,
             type: "POST",
             url: '<%=path%>/verifyCode/findPinNum.do',
             async: false,
             dataType:"json",
             error: function(request) {
               alert('操作失败，请稍候重试!');  
             },
            success:function(data){
				if(data.success){
					var pinValue=data.obj;
					$("#pinNum").val(pinValue);
				}
			}
        });
}
</script>
</head>
<body style="font-family: '微软雅黑';padding: 0px;">
	<div id="contentDiv" style="padding:5px; width:99%;">
 	<div style="width:100%;height:30px;border-bottom:1px solid #ADADAD;">
 		<div class="toptil">修改密码</div>
 	</div>
	<div class="secr_flowsteps">
		<ol class="secr_step3">
		<li class="current" style="width:33.33%;"><span class="first">1.验证身份</span></li>
		<li class="next" style="width:33.33%;" ><span>2.重置密码</span></li>
		<li class="" style="width:33.33%;"><span>3.完成</span></li>
		</ol>
	</div>	
	<div id="divForm"  class="formTable" style="margin-left:5px;padding:5px;width:98%;">
		<form id="form1" name="form1" method="post" style="margin:0px;">
		<input type="hidden" id="pwdBefore" name="pwdBefore"  value="${userMap.LOGIN_PASSWORD }"  />
		<input type="hidden" id="uuidBefore" name="uuidBefore"  value="${userMap.PERSON_UUID }"  />
		<input type="hidden" id="accountBefore" name="accountBefore"  value="${userMap.PERSON_ACCOUNT }"  />
		<input type="hidden" id="pinNum" name="pinNum"  />
    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
        	<!-- 
        	<tr>
				<td  style="width:15%;padding-left:20px;text-align:right;font-size:16px;">请选择验证方式：</td>
                <td  style="width:85%;height:50px;">
                	<select class="setopt" id="pinWay" name="pinWay" style="height:30px;">
		                <option value="">手机</option>
		                <option value="no">登录密码</option>
		                <option value="yes">有效证件找回</option>
		            </select>
                </td>
            </tr>
        	 -->
        	<tr>
				<td style="width:15%;padding-left:20px;text-align:right;font-size:14px;">登录密码：</td>
                <td style="width:85%;height:50px;padding-top:20px;">
                	<input id="loginPwd" name="loginPwd" type="password" nowrap style="width: 150px;height:30px;" />
                	<div class="entry-hint" style="padding-top:0px;margin-top:0px;">
               		 <div id="error_pwd_tip" class="icon-c" style="display:none;font-size:14px;color:red;"><p></p><span>登录密码输入不正确！</span></div>
               		</div>
                </td>
            </tr>
            <tr>
				<td  style="width:15%;padding-left:20px;text-align:right;font-size:14px;">验证码：</td>
                <td  style="width:85%;height:50px;padding-top:4px;" >
                	<div style="height:50px;line-height:50px;over-flow:hidden;">
	                	<div style="width:155px;height:50px;padding-top:10px;line-height:50px;vertical-align: baseline;float:left;">
	                		<input id="pin" name="pin" type="text" style="width: 150px;height:30px;" />
	                	</div>
	                	<div style="width:80px;height:50px;padding-top:10px;line-height:50px;vertical-align: baseline;float:left;">
	                		<img id="pinpic" src = "<%=path %>/verifyCode/refresh.do?widthP=70&heightP=30" style="width:70px;height:30px;" onclick="_refresh();"/>
	                	</div>
	                	<a href="javascript:void('')" onclick="_refresh();" target="_self" ><span style="font-size:14px;">换一张</span></a>
                	</div>
                </td>
            </tr>
            <tr style="display:none;" id="error_pin_tip_tr">
				<td  style="width:15%;padding-left:20px;text-align:right;font-size:14px;"></td>
                <td  style="width:85%;height:30px;" >
                	<div class="entry-hint" style="padding-top:0px;margin-top:0px;">
						<div id="error_pin_tip" class="icon-c" style="font-size:14px;color:red;"><p></p><span>验证码输入不匹配！</span></div>
                	</div>
                </td>
            </tr>
            <tr>
            	<td  style="width:15%;padding-left:20px;"></td>
                <td   style="width:85%;" align="left" >
					<input type="button" style="border:none;background-position:3px -286px" class="btn_base" style="" value="下一步" onclick="_next()"/>
                </td>
            </tr>
            <tr style="height:30px;"></tr>
            <tr>
            	<td colspan="2"  style="width:85%;height:30px;font-size:14px;text-align:left;" ><span>请尽量保证您的密码安全！</span></td>
            </tr> 
            <tr>
            	<td colspan="2"  style="width:85%;height:30px;font-size:14px;text-align:left;display:none;" ><span>有效证件找回需要1个工作日完成审核，审核结果会以短信形式发至您的手机。如果未收到短信，请拨打：</span></td>
            </tr> 
            <tr>
            	<td colspan="2"  style="width:85%;height:30px;font-size:14px;text-align:left;display:none;" ><span> 免费会员咨询热线：400-6360-888(免长途费)</span></td>
            </tr> 
           
        </table>
        </form>
    </div> 
	
 	</div>
 </body>
 <script type="text/javascript">
 $(document).ready(function(){
		_reHeight("rightFrame","contentDiv");
 });

  </script>
</html>
